#pragma once
#include <io.h>
#include <string>
#include <vector>
#include "sqlite3/include/sqlite3.h"
#include "cocos2d.h"
#include "StringTools.h"
#include "NoteManager.h"
#include <time.h>
#include <thread>

using namespace std;
using namespace cocos2d;

class DataBase
{
	public:
	DataBase(Label* labelInfo = nullptr);
	virtual ~DataBase();

	public:
	enum GAMEMODE
	{
		MODE_CLASSIC,
		MODE_FX
	};

	sqlite3 *pdb;
	Label* info;

	private:
	string dbpath = "music.db";
	vector<string> osuFiles;
	vector<string> bmsFiles;

	public:
	void scanFiles(string path);

	void writeMusicDB();

	void createMusicTables();

	NoteManager* getRandomMusicNote();
	NoteManager* getMusicNoteBySetId(string setid);
	NoteManager* getMusicNoteBySetAndNoteId(string setid, string noteid);

	string getMusicDDL();

};